package com.wzy.vx.Utils.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;

import java.io.IOException;
import java.util.Date;

import static org.aspectj.bridge.Version.getTime;

/**
 * @ProjectName: vx
 * @Package: com.wzy.vx.Utils.serializer
 * @ClassName: Date2Long
 * @Author: Administrator
 * @Description: ${description}
 * @Date: 2019/3/14 11:41
 * @Version: 1.0
 */
public class Date2Long extends JsonSerializer<Date> {

    @Override
    public void serialize(Date date, JsonGenerator gen, SerializerProvider serializers) throws IOException {
         gen.writeNumber(date.getTime()/1000);
    }
}
